////////////////////////////////////////////////////////////////////////////////
//      
//      Kingsoft File for shp routines file
//      
//      File      : shp_link.h
//      Comment   : simple html parser btn(button) object class
//					
//      Create at : 2009-01-13
//      Create by : chenguicheng
//      
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "shpsupport.h"
#include "shp_txt.h"
#include "shp_img.h"

#define SHP_BTN_ITEM_KEY					TEXT("btn")

class shp_btn_item : public shp_txt_item
{
public:
	shp_btn_item()
	{
		
	}

	~shp_btn_item()
	{
		
	}

	void draw_item( shpdc& dc, CRect& draw_rect )
	{
		shp_skin_mgr::Instance().draw( dc, get_state(), m_str_skin, get_item_rect(), draw_rect, false );
		shp_txt_item::_draw_item( dc, get_item_rect(), false );
	}

	bool hit_test( UINT umsg, int x, int y, DWORD& dw_id )
	{
		return shp_txt_item::hit_test( umsg, x, y, dw_id );
	}

	void init_rect( CRect& parent_rect )
	{
		__super::calc_rect( parent_rect );
	}

	//set_attribute( p, m )
	BEGIN_KEY_MAP()
		//to add new attribute map( key map to member )
		ADD_STR_KEY( L"skin",		m_str_skin )
		BASE_CLASS_PROCESS(shp_txt_item)
	END_KEY_MAP()

protected:

	shpstr		m_str_skin;
	
};
